﻿using DevExpress.Utils.Win;
using DevExpress.XtraEditors.Popup;
using DevExpress.XtraGrid.Editors;
using DevExpress.XtraLayout;
using DevExpress.XtraTab;
using DXApplicationTangche.UC.成品出库单.service;
using DXApplicationTangche.UC.生产计划.生产批生产.service;
using DXApplicationTangche.UC.盘点.Service;
using DXApplicationTangche.UC.盘点.盘点UC;
using DXApplicationTangche.UC.销售记录.service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 盘点Service = DXApplicationTangche.UC.盘点.Service.盘点Service;


namespace DXApplicationTangche.UC.盘点
{
    public partial class Form盘点扫码 : DevExpress.XtraEditors.XtraForm
    {
        private StockInventoryPlanDTO stockInventoryPlanDTO = new StockInventoryPlanDTO();//单个盘点大计划
        public Form盘点扫码(StockInventoryPlanDTO stockInventoryPlanDTO)
        {
            //传参 单击行的盘点计划id，调接口绑定数据源
            InitializeComponent();
            this.stockInventoryPlanDTO = stockInventoryPlanDTO;
            this.loadTab();
        }
        private void loadTab()
        {
            foreach (StockStoreInventoryPlanShowDTO dTO in this.stockInventoryPlanDTO.stockStoreInventoryPlanShowDTOS)
            {
                this.addTab(dTO);
            }
        }
        private void addTab(StockStoreInventoryPlanShowDTO stockStoreInventoryPlanShowDTO)
        {
            XtraTabPage newTabPage = new XtraTabPage();
            newTabPage.Name = stockStoreInventoryPlanShowDTO.storeName + "盘点计划";//设置新TabPage的Name
            newTabPage.Text = stockStoreInventoryPlanShowDTO.storeName + "盘点计划";//设置新TabPage的标题文本
            //form.TopLevel = false;
            XtraUserControl门店盘点计划 xtraUserControl = new XtraUserControl门店盘点计划(stockInventoryPlanDTO.stockInventoryPlanCode,  stockStoreInventoryPlanShowDTO.stockStoreInventoryPlanCode);
            this.xtraTabControl门店盘点计划.TabPages.Add(newTabPage);//添加
            //this.xtraTabControl门店盘点计划.SelectedTabPage = newTabPage;//设置为选中
            newTabPage.Controls.Add(xtraUserControl);
            xtraUserControl.Dock = System.Windows.Forms.DockStyle.Fill;
            xtraUserControl.Show();
        }
    }
}
